<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit">
    <title></title>
    <!-- bootstrap & fontawesome -->
    <link rel="stylesheet" href="__PUBLIC__/assets/css/bootstrap.css" />
    <link rel="stylesheet" href="__PUBLIC__/assets/css/font-awesome.css" />
    <!-- text fonts -->
    <link rel="stylesheet" href="__PUBLIC__/assets/css/ace-fonts.css" />

    <!-- ace styles -->
    <link rel="stylesheet" href="__PUBLIC__/assets/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />
    <link rel="stylesheet" href="__PUBLIC__/css/admin/admin_manage.css" />
</head>
<body>
    <div class="top-div">
        <a class="cur_pa" href="__URL__/index">管理员管理</a>
        <a href="__URL__/add">新增管理员</a>
    </div>
    <div class="table-content">
        <table id="sample-table-2" class="table table-striped table-bordered table-hover">
            <thead>
            <tr>
                <th>序号</th>
                <th>用户名</th>
                <th class="hidden-480">所属角色</th>

                <th>
                    最后登录IP
                </th>
                <th class="hidden-480">最后登录时间</th>

                <th>EMail</th>
                <th>姓名</th>
                <th>操作</th>
            </tr>
            </thead>

            <tbody>
                <volist name="list" id="admin" key="k">
                    <tr>
                        <td>
                            {$k}
                        </td>
                        <td>{$admin['username']}</td>
                        <td>{$admin['role_id']}</td>
                        <td>{$admin['loginip']}</td>

                        <td>
                            {$admin['logintime']}
                        </td>
                        <td>
                            {$admin['email']}
                        </td>
                        <td>
                            {$admin['realname']}
                        </td>

                        <td>
                            <div class="">
                                <a class="blue" href="__URL__/edit?id={$admin['id']}">
                                    编辑
                                </a>
                                <if condition="$admin['id'] eq 1 ">
                                    <a class="grey" href="#">
                                        删除
                                    </a>
                                    <else />
                                    <a class="green" href="javascript:confirm_del({$admin['id']})">
                                        删除
                                    </a>
                                </if>

                            </div>
                        </td>
                    </tr>
                </volist>
            </tbody>
        </table>
    </div>

</body>
<script src='__PUBLIC__/assets/js/jquery.js'></script>
<script src="__PUBLIC__/assets/js/bootstrap.js"></script>
<script src="__PUBLIC__/assets/js/ace/ace.js"></script>
<script>
    function confirm_del(id){
        var url = '__URL__/del?id='+id;
        var r = confirm("确定要删除吗？");
        if (r == true){
            $.getJSON(url, function(result){
                console.log(result);
                if(result.status == 1){
                    alert('删除成功');
                }else{
                    alert('删除失败');
                }
            });
        }
    }
</script>
</html>